{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "1ee16035-331b-42aa-b4ab-1d95cd2599bc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-05-21T13:20:28.783885Z",
     "iopub.status.busy": "2022-05-21T13:20:28.783396Z",
     "iopub.status.idle": "2022-05-21T13:20:29.128773Z",
     "shell.execute_reply": "2022-05-21T13:20:29.128108Z",
     "shell.execute_reply.started": "2022-05-21T13:20:28.783816Z"
    }
   },
   "outputs": [],
   "source": [
    "# 导入包\n",
    "import numpy as np\n",
    "import pandas as pd"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "d31b86af-079e-459b-9e22-fe359239342c",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-05-21T13:22:26.049796Z",
     "iopub.status.busy": "2022-05-21T13:22:26.049465Z",
     "iopub.status.idle": "2022-05-21T13:22:26.075775Z",
     "shell.execute_reply": "2022-05-21T13:22:26.075140Z",
     "shell.execute_reply.started": "2022-05-21T13:22:26.049772Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>-0.052878</td>\n",
       "      <td>1.510850</td>\n",
       "      <td>0.222697</td>\n",
       "      <td>0.796842</td>\n",
       "      <td>0.435159</td>\n",
       "      <td>0.127847</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>-0.355316</td>\n",
       "      <td>-0.410189</td>\n",
       "      <td>-0.078490</td>\n",
       "      <td>0.798465</td>\n",
       "      <td>-0.463565</td>\n",
       "      <td>0.963816</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>-1.142646</td>\n",
       "      <td>0.235284</td>\n",
       "      <td>-0.961283</td>\n",
       "      <td>0.113485</td>\n",
       "      <td>1.469585</td>\n",
       "      <td>-0.241021</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>-1.622643</td>\n",
       "      <td>-0.072884</td>\n",
       "      <td>0.450259</td>\n",
       "      <td>1.078257</td>\n",
       "      <td>0.389640</td>\n",
       "      <td>-1.219306</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>-0.731036</td>\n",
       "      <td>-1.753267</td>\n",
       "      <td>0.666099</td>\n",
       "      <td>0.026916</td>\n",
       "      <td>0.222161</td>\n",
       "      <td>-1.111202</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.802597</td>\n",
       "      <td>0.488025</td>\n",
       "      <td>0.912538</td>\n",
       "      <td>2.024332</td>\n",
       "      <td>-0.406723</td>\n",
       "      <td>0.610793</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-2.277881</td>\n",
       "      <td>0.591904</td>\n",
       "      <td>1.264466</td>\n",
       "      <td>0.059422</td>\n",
       "      <td>2.606031</td>\n",
       "      <td>0.886292</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>-0.935649</td>\n",
       "      <td>-0.583892</td>\n",
       "      <td>-1.445245</td>\n",
       "      <td>-0.281013</td>\n",
       "      <td>0.767694</td>\n",
       "      <td>0.593149</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-1.566424</td>\n",
       "      <td>-1.513462</td>\n",
       "      <td>-1.792274</td>\n",
       "      <td>-0.716712</td>\n",
       "      <td>0.636776</td>\n",
       "      <td>-2.474987</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>-0.350835</td>\n",
       "      <td>-1.315409</td>\n",
       "      <td>-0.683694</td>\n",
       "      <td>-1.419101</td>\n",
       "      <td>0.058664</td>\n",
       "      <td>1.020522</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>1.507457</td>\n",
       "      <td>1.178389</td>\n",
       "      <td>0.934787</td>\n",
       "      <td>-0.264967</td>\n",
       "      <td>-1.737426</td>\n",
       "      <td>-1.138735</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>1.636618</td>\n",
       "      <td>0.427745</td>\n",
       "      <td>-0.355058</td>\n",
       "      <td>-1.978786</td>\n",
       "      <td>0.737580</td>\n",
       "      <td>0.021002</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>-0.947251</td>\n",
       "      <td>0.588557</td>\n",
       "      <td>0.410521</td>\n",
       "      <td>-0.107585</td>\n",
       "      <td>0.663658</td>\n",
       "      <td>-0.056342</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>0.404890</td>\n",
       "      <td>0.013400</td>\n",
       "      <td>0.004126</td>\n",
       "      <td>-0.928908</td>\n",
       "      <td>-0.374385</td>\n",
       "      <td>1.641765</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>1.115930</td>\n",
       "      <td>0.393702</td>\n",
       "      <td>1.279673</td>\n",
       "      <td>-0.922295</td>\n",
       "      <td>0.203653</td>\n",
       "      <td>-0.272889</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>0.269282</td>\n",
       "      <td>0.019549</td>\n",
       "      <td>-1.571218</td>\n",
       "      <td>-1.508589</td>\n",
       "      <td>-0.279218</td>\n",
       "      <td>-0.755746</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>-0.410885</td>\n",
       "      <td>0.802154</td>\n",
       "      <td>-0.014084</td>\n",
       "      <td>1.967340</td>\n",
       "      <td>-0.971769</td>\n",
       "      <td>-1.569003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>-0.112387</td>\n",
       "      <td>-2.298846</td>\n",
       "      <td>-0.179993</td>\n",
       "      <td>-1.135931</td>\n",
       "      <td>0.431815</td>\n",
       "      <td>-1.041777</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>0.372021</td>\n",
       "      <td>-0.107546</td>\n",
       "      <td>0.197567</td>\n",
       "      <td>0.348042</td>\n",
       "      <td>0.890397</td>\n",
       "      <td>-0.539497</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0.359043</td>\n",
       "      <td>-0.445150</td>\n",
       "      <td>-0.181534</td>\n",
       "      <td>0.902386</td>\n",
       "      <td>-0.751714</td>\n",
       "      <td>2.788848</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>-0.680107</td>\n",
       "      <td>-0.836421</td>\n",
       "      <td>0.890215</td>\n",
       "      <td>0.210765</td>\n",
       "      <td>-1.482531</td>\n",
       "      <td>0.177348</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>-0.611912</td>\n",
       "      <td>0.222098</td>\n",
       "      <td>-0.595089</td>\n",
       "      <td>1.484574</td>\n",
       "      <td>-0.858176</td>\n",
       "      <td>0.003916</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>-0.268391</td>\n",
       "      <td>-1.679097</td>\n",
       "      <td>0.496601</td>\n",
       "      <td>0.375821</td>\n",
       "      <td>-0.131294</td>\n",
       "      <td>1.281527</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>0.670236</td>\n",
       "      <td>1.311658</td>\n",
       "      <td>0.224289</td>\n",
       "      <td>-0.605135</td>\n",
       "      <td>1.184044</td>\n",
       "      <td>-2.305233</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>-0.726257</td>\n",
       "      <td>-0.687708</td>\n",
       "      <td>-0.358483</td>\n",
       "      <td>-2.177222</td>\n",
       "      <td>0.174636</td>\n",
       "      <td>1.769137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>-0.396439</td>\n",
       "      <td>0.720446</td>\n",
       "      <td>-0.454862</td>\n",
       "      <td>-0.835015</td>\n",
       "      <td>0.889112</td>\n",
       "      <td>-0.033184</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>-0.362103</td>\n",
       "      <td>-0.872927</td>\n",
       "      <td>-0.512528</td>\n",
       "      <td>0.969086</td>\n",
       "      <td>-0.889421</td>\n",
       "      <td>0.966084</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>0.713547</td>\n",
       "      <td>0.213854</td>\n",
       "      <td>0.061950</td>\n",
       "      <td>-1.962634</td>\n",
       "      <td>0.258680</td>\n",
       "      <td>0.772085</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>-0.445102</td>\n",
       "      <td>1.075065</td>\n",
       "      <td>0.541279</td>\n",
       "      <td>-0.411035</td>\n",
       "      <td>-0.531031</td>\n",
       "      <td>0.531304</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>-1.506816</td>\n",
       "      <td>-0.824729</td>\n",
       "      <td>1.025184</td>\n",
       "      <td>2.483166</td>\n",
       "      <td>0.653574</td>\n",
       "      <td>1.139659</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           0         1         2         3         4         5\n",
       "0  -0.052878  1.510850  0.222697  0.796842  0.435159  0.127847\n",
       "1  -0.355316 -0.410189 -0.078490  0.798465 -0.463565  0.963816\n",
       "2  -1.142646  0.235284 -0.961283  0.113485  1.469585 -0.241021\n",
       "3  -1.622643 -0.072884  0.450259  1.078257  0.389640 -1.219306\n",
       "4  -0.731036 -1.753267  0.666099  0.026916  0.222161 -1.111202\n",
       "5   0.802597  0.488025  0.912538  2.024332 -0.406723  0.610793\n",
       "6  -2.277881  0.591904  1.264466  0.059422  2.606031  0.886292\n",
       "7  -0.935649 -0.583892 -1.445245 -0.281013  0.767694  0.593149\n",
       "8  -1.566424 -1.513462 -1.792274 -0.716712  0.636776 -2.474987\n",
       "9  -0.350835 -1.315409 -0.683694 -1.419101  0.058664  1.020522\n",
       "10  1.507457  1.178389  0.934787 -0.264967 -1.737426 -1.138735\n",
       "11  1.636618  0.427745 -0.355058 -1.978786  0.737580  0.021002\n",
       "12 -0.947251  0.588557  0.410521 -0.107585  0.663658 -0.056342\n",
       "13  0.404890  0.013400  0.004126 -0.928908 -0.374385  1.641765\n",
       "14  1.115930  0.393702  1.279673 -0.922295  0.203653 -0.272889\n",
       "15  0.269282  0.019549 -1.571218 -1.508589 -0.279218 -0.755746\n",
       "16 -0.410885  0.802154 -0.014084  1.967340 -0.971769 -1.569003\n",
       "17 -0.112387 -2.298846 -0.179993 -1.135931  0.431815 -1.041777\n",
       "18  0.372021 -0.107546  0.197567  0.348042  0.890397 -0.539497\n",
       "19  0.359043 -0.445150 -0.181534  0.902386 -0.751714  2.788848\n",
       "20 -0.680107 -0.836421  0.890215  0.210765 -1.482531  0.177348\n",
       "21 -0.611912  0.222098 -0.595089  1.484574 -0.858176  0.003916\n",
       "22 -0.268391 -1.679097  0.496601  0.375821 -0.131294  1.281527\n",
       "23  0.670236  1.311658  0.224289 -0.605135  1.184044 -2.305233\n",
       "24 -0.726257 -0.687708 -0.358483 -2.177222  0.174636  1.769137\n",
       "25 -0.396439  0.720446 -0.454862 -0.835015  0.889112 -0.033184\n",
       "26 -0.362103 -0.872927 -0.512528  0.969086 -0.889421  0.966084\n",
       "27  0.713547  0.213854  0.061950 -1.962634  0.258680  0.772085\n",
       "28 -0.445102  1.075065  0.541279 -0.411035 -0.531031  0.531304\n",
       "29 -1.506816 -0.824729  1.025184  2.483166  0.653574  1.139659"
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 创建实验数据\n",
    "data = pd.DataFrame(np.random.randn(30,6))\n",
    "data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "id": "62a1e5e6-85b8-4e27-b1ba-b7333c4d8034",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-05-21T13:50:58.573485Z",
     "iopub.status.busy": "2022-05-21T13:50:58.573156Z",
     "iopub.status.idle": "2022-05-21T13:50:58.635950Z",
     "shell.execute_reply": "2022-05-21T13:50:58.634695Z",
     "shell.execute_reply.started": "2022-05-21T13:50:58.573462Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>0.802597</td>\n",
       "      <td>0.488025</td>\n",
       "      <td>0.912538</td>\n",
       "      <td>2.024332</td>\n",
       "      <td>-0.406723</td>\n",
       "      <td>0.610793</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>-2.277881</td>\n",
       "      <td>0.591904</td>\n",
       "      <td>1.264466</td>\n",
       "      <td>0.059422</td>\n",
       "      <td>2.606031</td>\n",
       "      <td>0.886292</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>-1.566424</td>\n",
       "      <td>-1.513462</td>\n",
       "      <td>-1.792274</td>\n",
       "      <td>-0.716712</td>\n",
       "      <td>0.636776</td>\n",
       "      <td>-2.474987</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>-0.112387</td>\n",
       "      <td>-2.298846</td>\n",
       "      <td>-0.179993</td>\n",
       "      <td>-1.135931</td>\n",
       "      <td>0.431815</td>\n",
       "      <td>-1.041777</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>0.359043</td>\n",
       "      <td>-0.445150</td>\n",
       "      <td>-0.181534</td>\n",
       "      <td>0.902386</td>\n",
       "      <td>-0.751714</td>\n",
       "      <td>2.788848</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>0.670236</td>\n",
       "      <td>1.311658</td>\n",
       "      <td>0.224289</td>\n",
       "      <td>-0.605135</td>\n",
       "      <td>1.184044</td>\n",
       "      <td>-2.305233</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>-0.726257</td>\n",
       "      <td>-0.687708</td>\n",
       "      <td>-0.358483</td>\n",
       "      <td>-2.177222</td>\n",
       "      <td>0.174636</td>\n",
       "      <td>1.769137</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>-1.506816</td>\n",
       "      <td>-0.824729</td>\n",
       "      <td>1.025184</td>\n",
       "      <td>2.483166</td>\n",
       "      <td>0.653574</td>\n",
       "      <td>1.139659</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "           0         1         2         3         4         5\n",
       "5   0.802597  0.488025  0.912538  2.024332 -0.406723  0.610793\n",
       "6  -2.277881  0.591904  1.264466  0.059422  2.606031  0.886292\n",
       "8  -1.566424 -1.513462 -1.792274 -0.716712  0.636776 -2.474987\n",
       "17 -0.112387 -2.298846 -0.179993 -1.135931  0.431815 -1.041777\n",
       "19  0.359043 -0.445150 -0.181534  0.902386 -0.751714  2.788848\n",
       "23  0.670236  1.311658  0.224289 -0.605135  1.184044 -2.305233\n",
       "24 -0.726257 -0.687708 -0.358483 -2.177222  0.174636  1.769137\n",
       "29 -1.506816 -0.824729  1.025184  2.483166  0.653574  1.139659"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 检测异常值，假设绝对值超过2就是异常值\n",
    "data[(np.abs(data)>2).any(axis=1)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "id": "754048ee-acb7-48c2-a3c3-301cd84155dc",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-05-21T14:09:36.747112Z",
     "iopub.status.busy": "2022-05-21T14:09:36.746777Z",
     "iopub.status.idle": "2022-05-21T14:09:36.777340Z",
     "shell.execute_reply": "2022-05-21T14:09:36.776663Z",
     "shell.execute_reply.started": "2022-05-21T14:09:36.747087Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>0</th>\n",
       "      <th>1</th>\n",
       "      <th>2</th>\n",
       "      <th>3</th>\n",
       "      <th>4</th>\n",
       "      <th>5</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>count</th>\n",
       "      <td>30.000000</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>30.000000</td>\n",
       "      <td>30.000000</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>mean</th>\n",
       "      <td>-0.112449</td>\n",
       "      <td>0.023000</td>\n",
       "      <td>0.013280</td>\n",
       "      <td>0.068456</td>\n",
       "      <td>0.106319</td>\n",
       "      <td>0.350918</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>std</th>\n",
       "      <td>0.933099</td>\n",
       "      <td>0.953597</td>\n",
       "      <td>0.800640</td>\n",
       "      <td>1.165808</td>\n",
       "      <td>0.852639</td>\n",
       "      <td>1.033527</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>min</th>\n",
       "      <td>-1.622643</td>\n",
       "      <td>-1.753267</td>\n",
       "      <td>-1.792274</td>\n",
       "      <td>-1.978786</td>\n",
       "      <td>-1.737426</td>\n",
       "      <td>-1.569003</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25%</th>\n",
       "      <td>-0.714719</td>\n",
       "      <td>-0.661754</td>\n",
       "      <td>-0.430767</td>\n",
       "      <td>-0.805439</td>\n",
       "      <td>-0.449354</td>\n",
       "      <td>-0.264922</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>50%</th>\n",
       "      <td>-0.353075</td>\n",
       "      <td>0.116701</td>\n",
       "      <td>0.033038</td>\n",
       "      <td>0.043169</td>\n",
       "      <td>0.212907</td>\n",
       "      <td>0.354326</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>75%</th>\n",
       "      <td>0.396672</td>\n",
       "      <td>0.591067</td>\n",
       "      <td>0.530109</td>\n",
       "      <td>0.876405</td>\n",
       "      <td>0.661137</td>\n",
       "      <td>1.006912</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>max</th>\n",
       "      <td>2.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>1.279673</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>2.000000</td>\n",
       "      <td>2.000000</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "               0          1          2          3          4          5\n",
       "count  30.000000  30.000000  30.000000  30.000000  30.000000  30.000000\n",
       "mean   -0.112449   0.023000   0.013280   0.068456   0.106319   0.350918\n",
       "std     0.933099   0.953597   0.800640   1.165808   0.852639   1.033527\n",
       "min    -1.622643  -1.753267  -1.792274  -1.978786  -1.737426  -1.569003\n",
       "25%    -0.714719  -0.661754  -0.430767  -0.805439  -0.449354  -0.264922\n",
       "50%    -0.353075   0.116701   0.033038   0.043169   0.212907   0.354326\n",
       "75%     0.396672   0.591067   0.530109   0.876405   0.661137   1.006912\n",
       "max     2.000000   2.000000   1.279673   2.000000   2.000000   2.000000"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# 处理异常值，所有异常值都替换成2\n",
    "data[np.abs(data)>2] = 2\n",
    "data.describe()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "446d3ecb-4b7f-438b-917a-49f8944c43e2",
   "metadata": {
    "execution": {
     "iopub.execute_input": "2022-05-21T13:48:37.934719Z",
     "iopub.status.busy": "2022-05-21T13:48:37.934391Z",
     "iopub.status.idle": "2022-05-21T13:48:37.942127Z",
     "shell.execute_reply": "2022-05-21T13:48:37.941365Z",
     "shell.execute_reply.started": "2022-05-21T13:48:37.934696Z"
    },
    "tags": []
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0     True\n",
       "1     True\n",
       "2    False\n",
       "3     True\n",
       "4     True\n",
       "5     True\n",
       "dtype: bool"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(np.abs(data)>2).any(axis=0)"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.10.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
